<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/13
 * Time: 19:50
 */

namespace Sslh\Auth\Model;

use  Sslh\Object\UserBean;
use EasySwoole\Mysqli\Mysqli;
use EasySwoole\EasySwoole\Config;

class AuthModel
{
    public $db = null;

    public function __construct()
    {
        $conf = new \EasySwoole\Mysqli\Config(\EasySwoole\EasySwoole\Config::getInstance()->getConf('MYSQL'));
        $this->db = new Mysqli($conf);
    }

    public function AddUser()
    {

    }

    public function GetUserInfo($phone, $passwd)
    {

        // TODO 查询数据
        $this->db ->where('phone',$phone,'=','and')->where('password',$passwd,'=','and');
        $data = $this->db->get('user');
        $sql = $this->db->getLastQuery();



	$data = $data[0];

        return new UserBean(['id'=>$data['id'], 'username'=>$data['username']]);
    }
}
